import { createSSRApp } from 'vue'
//@ts-ignore
import uView from './uni_modules/vk-uview-ui'
import { $showToast } from '@/utils/msg'
import App from './App.vue'
import store from './store/global'
import { useAmapKeyStore } from './store/modules/amapKey'
import { doGetAmapKey } from './apis/amap'

const amapKeyStore = useAmapKeyStore(store)
doGetAmapKey().then((res) => {
    console.log(res)
    if (res.data) {
        amapKeyStore.SET_ALL_KEY(res.data)
    }
})

uni.$msg = $showToast
export function createApp() {
    const app = createSSRApp(App)
    app.use(store).use(uView)
    return {
        app,
    }
}
